home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / Blitz2 / BlitzFaq / FaqLists / SendArexxMex.txt < prev    next >
Encoding:
Text File  |  1996-09-05  |  1.3 KB  |  49 lines

  1. XINCLUDE rexxstorage.bb2 ;=include/rexx/storage.h
  2.  
  3. DEFTYPE.MsgPort *replyport
  4. DEFTYPE.RexxMsg *rexxmsg
  5. DEFTYPE.l
  6.  
  7. Statement sendrexx{rexx$}
  8.  
  9.   ;make complex pointers global or Blitz 1.80 will be confused sometimes
  10.   SHARED *replyport.MsgPort,*rexxmsg.RexxMsg   
  11.   name$="BLITZBLANK"
  12.   *rexxmsg=CreateRexxMsg_(*replyport,0,&name$) 
  13.   If *rexxmsg                                  
  14.     *arg=CreateArgstring_(&rexx$,Len(rexx$))
  15.     If *arg
  16.       *rexxmsg\rm_Args=*arg
  17.  
  18.       ;set #RXFF_RESULT to request a resultstring
  19.       *rexxmsg\rm_Action=#RXCOMM|#RXFF_NOIO|#RXFF_RESULT
  20.       Forbid_
  21.       *arexxport=FindPort_(&name$)
  22.       If *arexxport
  23.         PutMsg_ *arexxport,*rexxmsg
  24.         Permit_
  25.         WaitPort_ *replyport
  26.         *rexxmsg=GetMsg_(*replyport)
  27.         If *rexxmsg\rm_Result1=0 AND *rexxmsg\rm_Result2<>0
  28.  
  29.           ;print resultstring
  30.           NPrint Peek$(*rexxmsg\rm_Result2)
  31.           DeleteArgstring_ *rexxmsg\rm_Result2
  32.         EndIf
  33.       Else
  34.         Permit_
  35.       EndIf
  36.       DeleteArgstring_ *rexxmsg\rm_Args
  37.     EndIf
  38.     DeleteRexxMsg_ *rexxmsg
  39.   EndIf
  40. End Statement
  41.  
  42. ;simple test-routine:
  43. ;we want to send many ARexx-messages, so create the port outside only once
  44. *replyport=CreateMsgPort_()
  45. If *replyport
  46.   sendrexx{"BLANK"}
  47.   DeleteMsgPort_ *replyport
  48. EndIf
  49.